<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.HashMap"%>
<%@page import="com.leruan.aasimp.entity.Forumuser"%>
<%@page import="java.util.List"%>
<%@page import="com.leruan.aasimp.entity.Mainpost"%>
<%@page import="com.leruan.aasimp.entity.UserTypeEnumEntity"%>
<%@page import="com.leruan.aasimp.entitydto.MainPostDto"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Forumuser forumuserDetail = (Forumuser)request.getAttribute("forumuserDetail");
Forumuser user = (Forumuser)request.getSession().getAttribute("user");
List<MainPostDto> mainPosts = (List<MainPostDto>)request.getAttribute("mainPosts");
Long replyNum = (Long)request.getAttribute("replyNum") ;
Long mainPostNum = (Long)(request.getAttribute("mainPostNum")) ;
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>的个人信息页 - </TITLE>
<LINK href="styles/green/ejforum.css" type=text/css rel=stylesheet>
</HEAD>
<BODY onkeydown="if(event.keyCode==27) return false;">
<SCRIPT src="js/common.js" type=text/javascript></SCRIPT>
<DIV class=wrap>
<table>
        <tr>
            <td >
                 <div style="height:73px; width: 193px; background-image: url('images/forumlogo.jpg')"></div>
            </td>
            <td align="right" width="1000%">
                <DIV id=foruminfo>
                <%if(null==user){
                %>
                <form action="login" onSubmit="checkfield(this); return false;" method="get">
                用户名：<input type=text id="username" name="username" size=13 maxlength=30 tabindex=1/>
                密码：<input type=password id="password1" name="password1" size=8 tabindex=2 onkeypress="if((event.keyCode?event.keyCode:event.charCode)==13) $('loginform').submit();"/>
                <INPUT type=hidden id="password" name="password">&nbsp;
                <button type="submit" name=loginsubmit tabIndex=3 style="width:46px">登录</button>
                <button type="button" name="register" tabIndex=3 style="width:46px" onclick="toRegister()">注册</button></form>
                <%
                } else{
                %>
                欢迎您! <a href="userDetails?username=<%=user.getUsername() %>&userId=<%=user.getUserId() %>"><%=user.getUsername() %></a> <a href="logout.action">退出登录</a>
                <%
                }%>
                </DIV>
            </td>
        </tr>
    </table>
<DIV id=header>
<DIV class=container>
<DIV class=spacectx><DIV class=mainbox>
<div style="width:24%">
<H2><a href="&act=topic" class="">主题</a>&nbsp;&nbsp;
	<a href="&act=reply" class="">回复</a></H2>
</div>
<TABLE cellSpacing=0 cellPadding=0>
  <TBODY>
  <TR>
    <TD colspan="5">
  		<p>&nbsp;&nbsp;总回复数(<%=replyNum %>)
		&nbsp;|&nbsp;&nbsp;总发帖数(<%=mainPostNum %>)</p>
	</TD></TR>
	<tr>
	<th>板块名</th>
	<th>标题</th>
	<th>点击数</th>
	<th>回复数</th>
	<th>发表日期</th>
	</tr>
	<%for(MainPostDto dto :mainPosts){
	%>
		<tr>
		<td><%=dto.getBoardName() %></td>
		<td><a href="viewPost?postId=<%=dto.getPostId() %>" target="blank"><%=dto.getPostTitle() %></a> </td>
		<td><%=dto.getHits() %></td>
		<td><%=dto.getReplyNum() %></td>
		<td><%=dto.getPostDate() %></td>
		</tr>
	<%
	} %>
	<%if(null==mainPosts){
	%>
  <TR>
    <TD><p>&nbsp;没有记录</p></TD></TR>
	<%
	} %>
    
</TBODY></TABLE></DIV>
<div class="pageNo" id="pageNo">
                <a href="userDetailsQuery?no=1&username=<%=forumuserDetail.getUsername() %>&userId=<%=forumuserDetail.getUserId() %>">首页</a>
                <c:if test="${sessionScope.pageNoSale != 1}">
                    <a href="userDetailsQuery?no=${sessionScope.pageNoSale-1}&username=<%=forumuserDetail.getUsername() %>&userId=<%=forumuserDetail.getUserId() %>">上一页</a>
                </c:if>
                <c:forEach var="i" begin="${sessionScope.pageNoCenterSale -2 }"
                    end="${sessionScope.pageNoCenterSale + 2}">
                    <c:if test="${i <= sessionScope.totalNoSale }">
                        <c:choose>
                            <c:when test="${i == sessionScope.pageNoSale}">
                                <a href="javascript:void(0)">${i}</a>
                            </c:when>
                            <c:otherwise>
                                <a href="userDetailsQuery?no=${i}&username=<%=forumuserDetail.getUsername() %>&userId=<%=forumuserDetail.getUserId() %>%>">${i}</a>
                            </c:otherwise>
                        </c:choose>
                    </c:if>
                </c:forEach>
                <c:if test="${sessionScope.pageNoSale +4 < sessionScope.totalNoSale}">
                    <a href="userDetailsQuery?no=${sessionScope.pageNoSale+1}&username=<%=forumuserDetail.getUsername() %>&userId=<%=forumuserDetail.getUserId() %>">下一页</a>
                </c:if>
                <a href="userDetailsQuery?no=${sessionScope.totalNoSale}&username=<%=forumuserDetail.getUsername() %>&userId=<%=forumuserDetail.getUserId() %>">末页</a>
                &nbsp;&nbsp;&nbsp;&nbsp;共有<label style="color: red;">${sessionScope.totalSale}</label>条帖子
            </div>
<DIV class=pages_btns>
</DIV></DIV>
<DIV class=side style="width:24%">
<DIV>
<H2>个人信息</H2>
<table class="info" border="0" cellspacing="0" cellpadding="0" width="100%">
	<tr><th>UID</th><td><%=forumuserDetail.getUserId() %></td></tr>
	<tr><th>用户名</th><td><%=forumuserDetail.getUsername() %></td></tr>
	<tr><th>昵称</th><td><%=forumuserDetail.getNickname() %></td></tr>
	<tr><th>类别</th><td><%=UserTypeEnumEntity.valueOf(Integer.parseInt(forumuserDetail.getUserType()+"")) %></td></tr>
	<tr><th>积分</th><td><%=forumuserDetail.getScore() %></td></tr>
	<tr><th>注册日期</th><td><%=forumuserDetail.getRegisterDate() %></td></tr>
	<tr><th>性别</th><td><%=forumuserDetail.getSex() %></td></tr>
	<tr><th>生日</th><td><%=forumuserDetail.getBirthday() %></td></tr>
	<tr><th>Email</th><td><%=forumuserDetail.getEmail() %></td></tr>
</table>
</DIV></DIV></DIV></DIV>
</BODY></HTML>
